# -*- coding: utf-8 -*-            
# @Author : HJH
# @Time : 2024/1/20 14:13
# @Use :
import datetime

import requests

headers = {
    "Host": "h5api.m.taobao.com",
    "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Microsoft Edge\";v=\"120\"",
    "b-fpt": "abfpt.lowsell(flywheel121A)",
    "warehousecode": "{\"clientType\":\"other\",\"os\":\"android\",\"osVersion\":\"6.0\",\"appVersion\":\"1.35.0\",\"containerVersion\":\"0.0.0\",\"pageType\":\"h5\",\"ttid\":\"12mtb0000155\",\"spm\":\"181.7437871\",\"spmUrl\":\"/tbtrip.181.11925144.10840050.d10\",\"spmPre\":\"181.27203027.kingkong.main_enter_flight\",\"fpt\":\"abfpt.lowsell(flywheel121A)\"}",
    "sec-ch-ua-mobile": "?1",
    "user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36 Edg/120.0.0.0",
    "content-type": "application/x-www-form-urlencoded",
    "accept": "application/json",
    "sec-ch-ua-platform": "\"Android\"",
    "origin": "https://market.m.taobao.com",
    "sec-fetch-site": "same-site",
    "sec-fetch-mode": "cors",
    "sec-fetch-dest": "empty",
    "referer": "https://market.m.taobao.com/",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"
}
cookies = {
    "cna": "K0TeHWtLhxMCAQAAAAAMLBd0",
    "l": "fBT-XpFuPzEhDRO-BOfZourza77TlIRAguPzaNbMi9fPOI1eY1rlW1BKs8TwCnGVF6-JJ3JN2NiWBeYBqgI-nxvOxSR13FkmnmOk-Wf..",
    "t": "d0d79dd5cb7685b0f4de6cfd9c67357c",
    "_samesite_flag_": "true",
    "cookie2": "17db34a54e11ddbf98ffbcfd30143f68",
    "_tb_token_": "361713f7757e6",
    "cancelledSubSites": "empty",
    "existShop": "MTcwNTMxODY5Mw%3D%3D",
    "mtop_partitioned_detect": "1",
    "_m_h5_tk": "ec1224e0b25a30286ab91cbc5f87ed10_1705738694222",
    "_m_h5_tk_enc": "09bc8180db3f14a690b1a1938d1080cf",
    "xlly_s": "1",
    "3PcFlag": "1705730783980",
    "sgcookie": "E1000y3rtKfKpGo5us4L7llv4LtGWLqAxOjQrdF4QxxFRInZ%2BWgVtQXriow3boa6m4OiRAQzsKxrp5BU0TnpJmFboQDQj9b6c5k52ex%2F9YUOIqCuV2LJqadddxHJevH%2BmSU6",
    "ockeqeudmj": "jIHfyv8%3D",
    "_w_tb_nick": "tb152968630",
    "munb": "4214014943",
    "WAPFDFDTGFG": "%2B4cMKKP%2B8PI%2BKK8fqXyEfp9MM7xypw%3D%3D",
    "_w_app_lg": "0",
    "unb": "4214014943",
    "uc3": "lg2=U%2BGCWk%2F75gdr5Q%3D%3D&vt3=F8dD3ChHGz0%2FBJ3fx%2FI%3D&id2=Vy65VI5el30iew%3D%3D&nk2=F5REO%2BpydpaITzc%3D",
    "uc1": "tmb=1&cookie15=W5iHLLyFOGW7aA%3D%3D&cookie16=UtASsssmPlP%2Ff1IHDsDaPRu%2BPw%3D%3D&pas=0&cookie14=UoYekETlWJnywQ%3D%3D&cookie21=URm48syIYn73&existShop=false",
    "csg": "f15d3983",
    "lgc": "tb152968630",
    "ntm": "1",
    "cookie17": "Vy65VI5el30iew%3D%3D",
    "dnk": "tb152968630",
    "skt": "98fb66419e515717",
    "uc4": "nk4=0%40FY4PaQjutsOEnMvC1PGJIweRVzwV8w%3D%3D&id4=0%40VXkeqg69hhpKBXVLaYbL9iAauhqs",
    "tracknick": "tb152968630",
    "_cc_": "URm48syIZQ%3D%3D",
    "_l_g_": "Ug%3D%3D",
    "sg": "032",
    "_nk_": "tb152968630",
    "cookie1": "ACu3UDxBdSYy4yt82JYoqWiLe1tJ%2FTI1xhUgLg6jKd8%3D",
    "tfstk": "eMxkbYm-pU7Wo5Z6HQISD12pAFuAN7sC_BEd9MCEus5fv_KJyeYDMsEKFg3CxBfDO_QR4Bd3tQdA8BCpe8TX6drJ24sLxgsCYfhtXcpJFMselBWlOL9PV1rn6cn9U11FevltFI5nVMu8xPYZ6nlly12G4YeY1-lR6L50jLxRUNzW9sqUYKTck1ohikremTjrKrzNThZC6mvLRy_PhtfO2-TBTmFy6bMmnPAPzt6qBxD0Ry_Phtftnx4MaaWf3AC..",
    "thw": "cn",
    "_fli_latitude": "35.3032",
    "_fli_longitude": "113.9267",
    "_fli_cityCode": "410700",
    "_fli_cityName": "%E6%96%B0%E4%B9%A1",
    "_fli_titleHeight": "0",
    "_fli_screenDix": "1.875",
    "isg": "BIeH4i6nrrXGUCryQrYRLfxdFjtRjFtuApVfbVl0opZyyKWKYVyJvofKbo6WIDPm"
}
url = "https://h5api.m.taobao.com/h5/mtop.trip.flight.listingsearch/1.1"
params = {
    "type": "originaljson",
    "api": "mtop.trip.flight.listingsearch",
    "v": "1.1",
    "ttid": "12mtb0000155",
    "appKey": "12574478",
    "t": int(datetime.datetime.now().timestamp() * 1000),  # 当前时间戳
    "sign": "61da0d085f3e01b5ca99096200e789d8"
}
data = {
    "data": "{\"searchType\":1,\"leaveDate\":\"2024-01-31\",\"adultPassengerNum\":1,\"depCityCode\":\"CAN\",\"arrCityCode\":\"SHA\",\"depCityName\":\"广州\",\"arrCityName\":\"上海\",\"containChild\":0,\"containInfant\":0,\"agentIds\":\"\",\"ttid\":\"12mtb0000155\",\"spm\":\"/tbtrip.181.11925144.10840050.d10\",\"program_type\":\"H5\",\"tripType\":\"1\",\"showOptionSelected\":\"{\\\"showOptionStatusMap\\\":{\\\"AFTER_PROMOTION_PRICE\\\":2,\\\"AVERAGE_PRICE\\\":2}}\",\"calendarSearchSourceType\":2,\"linkedId\":\"d0b068c7a9a34ed6987292f7bc8b7896_215040cc17057309650063981e4625_\",\"clientSource\":4,\"sortBy\":\"AFTER_PROMOTION_PRICE_ASC\",\"fetchType\":1,\"marketingModuleOption\":\"{\\\"selectedHotelDiscount\\\":false}\",\"h5Version\":\"1.35.0\"}"
}
response = requests.post(url, headers=headers, cookies=cookies, params=params, data=data)

print(response.text)
print(response)
